<?php
define('__ROOT__', dirname(dirname(__FILE__))); 
include_once(__ROOT__.'/includes/header.php'); 
?>
<div class="span9"> 
	<ul class="breadcrumb">
	<li>
		<a href="<?php echo base_url('/home'); ?>">Home</a> <span class="divider">/</span>
	</li>
	<li>
		<a href="<?php echo base_url('/property'); ?>">Property</a>
	</li>
	<?php if (isset($bookmark)): ?>
	<span class="divider">/</span>
	<li>
		<?php echo $bookmark; ?></a>
	</li>
	<?php endif;?>
	</ul>
	<form class="well search_top_form" id="propertySearchfrm" method="post" action="<?php echo base_url('property/search'); ?>">						
		   <ul>
				<li>
					<input type="text" name="keyword" id="keyword" style="width: 220px;" class="input-xlarge" value="<?php echo isset($keyword) ? $keyword : null; ?>" placeholder="Keyword...">
				</li>
				<li>
					<select name="searchCity" id="searchCity" class="input-large bfh-states" data-country="MM" data-state="<?php echo isset($city) ? $city : null; ?>"></select>
				</li>
				<li>
					<?php $typeid= isset($propertyType) ? $propertyType : ''; ?>
					<?php echo form_dropdown('dropdown_type', $catg, $typeid, 'class="dropdown_class" style="width: 160px; font-size: 13px" id="dropdown_type"'); ?>
				</li>
				
		   </ul>
		   <ul>
				
				<li>
					<?php $bedrm_selected= isset($bedrm) ? $bedrm : ''; ?>
					<select id="dropdown_bedrooms" name="dropdown_bedrooms" style="width: 120px">
						<option value="0">Bedrooms...</option>
						<option value="1" <?php echo ($bedrm_selected == 1) ? 'selected': ''; ?>>1</option>
						<option value="2" <?php echo ($bedrm_selected == 2) ? 'selected': ''; ?>>2</option>
						<option value="3" <?php echo ($bedrm_selected == 3) ? 'selected': ''; ?>>3</option>
						<option value="4" <?php echo ($bedrm_selected == 4) ? 'selected': ''; ?>>4</option>
						<option value="5" <?php echo ($bedrm_selected == 5) ? 'selected': ''; ?>>5</option>
						<option value="6" <?php echo ($bedrm_selected == 6) ? 'selected': ''; ?>>6 and above</option>
					</select>
				</li>
				<li>
				<?php $bathrm_selected= isset($bathrm) ? $bathrm : ''; ?>
					<select id="dropdown_bathrooms" name="dropdown_bathrooms" style="width: 120px">
						<option value="0">Bathrooms...</option>
						<option value="1" <?php echo ($bathrm_selected == 1) ? 'selected': ''; ?>>1</option>
						<option value="2" <?php echo ($bathrm_selected == 2) ? 'selected': ''; ?>>2</option>
						<option value="3" <?php echo ($bathrm_selected == 3) ? 'selected': ''; ?>>3</option>
						<option value="4" <?php echo ($bathrm_selected == 4) ? 'selected': ''; ?>>4</option>
						<option value="5" <?php echo ($bathrm_selected == 5) ? 'selected': ''; ?>>4 and above</option>
					</select>
				</li>
				<li>
					<input type="checkbox" id="checkRental" name="checkRental"> search rental also?
					<button class="btn btn-warning"><i class="icon-search icon-white"></i> Search Now</button>
					<a href="<?php echo base_url('/property'); ?>"><u>clear results</u></a>
				</li>
		   
		   </ul>
	</form>
    
	<div class="main_content detail-product">	
	<p class="pull-right"> 	Filter: 
	<a href="<?php echo base_url('property'); ?>">All </a> | 
	<a href="<?php echo base_url('property/filter/1'); ?>">Sell </a>| 
	<a href="<?php echo base_url('property/filter/2'); ?>">Buy </a>| 
	<a href="<?php echo base_url('property/filter/3'); ?>">Rent </a>|
	<a href="<?php echo base_url('property/filter/4'); ?>">Long tenture </a></p>					
	<h3 class="title"><?php if (isset($selectedcatg))
									echo $selectedcatg . '- ';
									?>Found <?php echo $num_rows; ?> LISTINGS</h3>
	<?php foreach($plist as $property): ?>
		<div class="listing-item">
			<div class="row-fluid">	
				<div class="span8">
					<div class="featured-item">	
					<div class="span3">
					<?php
							if (isset($property->primary_image)){
								$url = '/assets/uploads/property/' . $property->primary_image;
							}else {
								$url = '/assets/uploads/dummy.png';
							}
							?>
							<a href="<?php echo site_url('property/details/' . $property->propertyID); ?>"><img src="<?php echo site_url($url); ?>" alt="<?php echo $property->title; ?>" title="<?php echo $property->title; ?>" class="img pull-left" width="140px" height="80px"></a>	
								<div class="rate">
									<img src="<?php echo site_url("assets/img/products/img_rateMiniStarOn.png"); ?>"  alt="Star On">
									<img src="<?php echo site_url("assets/img/products/img_rateMiniStarOn.png"); ?>" alt="Star On">
									<img src="<?php echo site_url("assets/img/products/img_rateMiniStarOn.png"); ?>" alt="Star On">
									<img src="<?php echo site_url("assets/img/products/img_rateMiniStarOn.png"); ?>" alt="Star On">
									<img src="<?php echo site_url("assets/img/products/img_rateMiniStarOn.png"); ?>" alt="Star Off">
								</div>
								<p>
									Tsp : Test<br>
									City: <span class="bfh-states" data-country="<?php echo $property->country; ?>" data-state="<?php echo $property->city; ?>"></span>
								</p>	
					</div>
					<div class="span9">
							<h5>
							<?php echo anchor(site_url('property/details/' . $property->propertyID), $property->title, 'title=""'); ?>
							</h5>
							<p>Published Date: <?php echo date ("d/m/Y",strtotime($property->posted_date)); ?></p>
							<span class="listing-content"><?php echo isset($property->bed_room)? $property->bed_room: '-'; ?> Bedrooms</span> 
							<span class="listing-content"><?php echo isset($property->bath_room)? $property->bath_room: '-'; ?> Bathrooms</span>
							<span class="listing-content"><?php echo isset($property->square_ft)? $property->square_ft:'-'; ?> Sqft </span>
							<span class="listing-content"><a href="<?php echo base_url('property/browse/') . '/'. $property->id; ?>"><?php echo $property->type; ?></a></span><br/><br />
							<?php
							$cleanDesc = strip_tags ($property->description);
							 $property->description = (strlen($cleanDesc) > 350) ? substr($cleanDesc,0,349).'...' : $cleanDesc;
							 echo $property->description;?>
							<i>(<?php echo anchor(base_url('property/details/' . $property->propertyID), 'View Details', 'title=""'); ?>)</i>
							
					</div>
					
					</div>
				</div>
				<div class="span4">
						<div class="other_info">
							<h3 class="price" style="color: #a6a6a6;"><?php echo $property->price . '  ';?><sup><?php echo $property->price_denote; ?></sup></h3>
							<?php 
							if ($property->is_negotiable)
								echo '<img src="' . site_url('assets/img/nego_button.gif') . '">';
							?>
							<hr/>
							<p>
								<a href="<?php echo base_url('property/details/' . $property->propertyID . '/#messagelink'); ?>"><button class="btn btn-small btn-primary"><i class="icon-envelope icon-white"></i> Contact Seller</button></a>
								<a href="<?php echo "tel:" . $property->contact_no; ?>"><button class="btn btn-small btn-primary"><i class="icon-volume-up icon-white"></i> Click to Call</button></a>
							</p>	
					</div>	
				</div>
			</div>
		</div>
	<?php endforeach; ?>
	<?php if (strlen($pagination)): ?>
		   <div>
			Pages: <?php echo $pagination; ?>
		   </div>
	<?php endif; ?>
</div></div>

<?php

include_once(__ROOT__.'/includes/rightnav.php');?>

<?php
include_once(__ROOT__.'/includes/footer.php'); 
?>
 <script type="text/javascript">
		//$(".collapse").collapse();
		//$('#accordion').collapse({hide: true});
		$('#collapseTwo').collapse('show');		
 </script>
